#ifndef __TINYSRV_LOCK_GUARD_H__
#define __TINYSRV_LOCK_GUARD_H__

#include "non_copyable.h"


namespace tinySrv
{  
   
  template <typename T>
  class LockGuard
    : private NonCopyable
  {
  public:
    LockGuard(T &obj)
      : Obj(obj)
    {
      Obj.Lock();
    }
    ~LockGuard()
    {
      Obj.Unlock();
    }
  private:
    T &Obj;
  };
  
}

#endif  // !__TINYSRV_LOCK_GUARD_H__
